Add and validate GraphMonomorphismMapper initial placement strategy#7827
Open
sefunmi4 wants to merge 9 commits intoquantumlib:mainfrom
Open
Add and validate GraphMonomorphismMapper initial placement strategy#7827sefunmi4 wants to merge 9 commits intoquantumlib:mainfrom
sefunmi4 wants to merge 9 commits intoquantumlib:mainfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Collaborator
|
cirq-cync - @pavoljuhas to do the initial review and than ask Tanuj for further feedback. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7827 +/- ##
========================================
Coverage 99.57% 99.57%
========================================
Files 1104 1106 +2
Lines 98938 99144 +206
========================================
+ Hits 98517 98723 +206
Misses 421 421 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR refines and validates the GraphMonomorphismMapper initial placement strategy for routing. The mapper embeds a circuit’s logical interaction graph as a monomorphism into the device topology, enabling swap-free execution when such an embedding exists. This provides an alternative to LineInitialMapper, particularly beneficial for small-to-medium qubit counts and sparse interaction graphs.
Motivation
LineInitialMapper is currently the primary initial placement strategy in Cirq. For circuits with non-linear but sparse connectivity, graph monomorphism–based placement can yield better initial layouts and avoid unnecessary swaps. This work supports ongoing efforts to expand Cirq’s routing strategies and aligns with discussions in issue #5859.
What changed
• Adjusted and formatted GraphMonomorphismMapper implementation for consistency with Cirq style.
• Updated and validated tests covering:
• Small circuits
• Line-like circuits
• Grid and ring device topologies
• Failure cases where no monomorphism exists
• Ensured deterministic, bounded runtime behavior in tests.
Testing
All checks were run in the Cirq development environment:
• ./check/format-incremental --apply
• ./check/pytest-changed-files -n 0
• ./check/mypy
• ./check/misc
All tests, type checks, and formatting checks pass.